<?php
namespace App\Http\Controllers\Wxxcx;

use App\Services\Wxxcx\SceneService;
use Illuminate\Http\Request;

class SceneController extends BaseController
{
    /**
     * 场景
     */

    public function __construct(SceneService $service)
    {
        $this->db = $service;
    }

    /**
     * 场景列表
     */
    public function getList(Request $request)
    {
        $res = $this->db->getList();
        if (!$res) {
            return $this->toJson(-2, '没有数据');
        }
        return $this->toJson(0, '', $res['data'], $res['total']);
    }

    /**
     * 内容列表
     */
    public function cntList(Request $request)
    {
        $scene_id = $request->post('scene_id', 0);
        $res = $this->db->cntList($scene_id);
        if (!$res) {
            return $this->toJson(-2, '没有数据');
        }
        return $this->toJson(0, '', $res['data'], $res['total']);
    }
}